package com.brkj.util;

import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;


public class SharePrefSaver {
	private SharedPreferences sharedPreferences;
	
	public SharePrefSaver(Context context, String name){
		sharedPreferences = context.getSharedPreferences(
				name, context.MODE_WORLD_READABLE);
	}
	
	public void save(String key, String value){
		Editor editor = sharedPreferences.edit();
		editor.putString(key, value);
		editor.commit();
	}
	
	public void save(String key, boolean value){
		Editor editor = sharedPreferences.edit();
		editor.putBoolean(key, value);
		editor.commit();
	}
	
	public String readStr(String key){
		return sharedPreferences.getString(key, "");
	}
	
	public boolean readBool(String key){
		return sharedPreferences.getBoolean(key, false);
	}
}
